package com.wrench.test;

import java.util.List;

import com.cellplus.comm.data.BaseDbcpDao;
import com.cellplus.comm.data.SqlAdapter;
import com.cellplus.comm.data.SqlFieldConfig;
import org.junit.Test;

import com.cellplus.comm.util.DbConstant;
import com.cellplus.comm.util.ImpCommUtil;
import com.ydd.wrench.bean.base.FormTable;
import com.ydd.wrench.bean.base.User;

public class testDb {

	
	@Test
	public void testSql(){
		BaseDbcpDao dao = new BaseDbcpDao("localhost:1433:data:sa:1", false, DbConstant.Db_SqlServer, null);
		String bok = dao.isConnOk();
		List<String> sqlCreateArr = SqlAdapter.getSqlCreateStr(DbConstant.Db_SqlServer, 0, "username",
				SqlAdapter.objToSqlFieldMap(User.class, User.getKeyCol(), null));
		int isok = dao.doSqlNoQueryConn(0, sqlCreateArr.get(0), null);
		
		System.out.println( bok + ","+isok);
	}
	
	@Test
	public void testSqlObjToSqlCreat(){
		List<SqlFieldConfig> val = SqlAdapter.objToSqlFieldMap(FormTable.class, FormTable.getKeyCol(),null);
		ImpCommUtil.Out(val);
	}
}
